//MODULO DE LA UNIDAD ARITMETICO LOGICA
module Alu(DatoInA, DatoInB,Shampt, Operacion, AluResult, Zero);
input [4:0] Shampt;
input [31:0] DatoInA, DatoInB;
input [3:0] Operacion;
output reg  [31:0] AluResult;
output Zero;

always @ (*) begin
    case (Operacion)
      4'h0:  AluResult = DatoInA&DatoInB; //and
      4'h1:  AluResult = DatoInA|DatoInB; //or
      4'h2:  AluResult = DatoInA+DatoInB; //add suma
      4'h3:  AluResult = DatoInA^DatoInB; //xor
      4'h6:  AluResult = DatoInA-DatoInB; //Zero= (!AluResult)? 1:0 ; end//subtract resta
      4'h7:  begin 
                /*if(DatoInB<DatoInA) */ AluResult = 32'h ff_ff_ff_ff;
                //if(DatoInB>=DatoInA) AluResult = 32'h 00_00_00_00;
             end  
      4'hC:  AluResult = ~(DatoInA|DatoInB); //NOR
      4'hD:  AluResult = ~(DatoInA&DatoInB); //NAND  
      4'hE:   AluResult =  DatoInB  >> Shampt[4:0]; //shift right
      4'hF:   AluResult =  DatoInB  << Shampt[4:0]; //shift left 
      default :
         AluResult=0;
    endcase
  end
  assign Zero = (AluResult==0)? 1 : 0;
endmodule